package IO.Buffered;

import java.io.*;

/**
 * 转换流(inputStreamReader,outputStreamWriter)
 * 1.以字符流的形式操作节点流(纯文本)
 * 2.可以指定字符集
 */
public class ConvertTest {
    public static void main(String[] args) {
        //操作System.out  System.in
        try(BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));//输入的字节进行了解码再装饰
        BufferedWriter writer =new BufferedWriter(new OutputStreamWriter(System.out));){
            //获取键盘的输入(exit退出),打印此内容
            String msg = "";
            while (!msg.equals("exit")){
                msg = reader.readLine();//循环读取
                writer.write(msg);//循环写出
                writer.newLine();
                writer.flush();//强制刷新一下

            }
        }catch (IOException e){
            System.out.println("操作异常");
        }
    }
}
